﻿@model IEnumerable<Shop.Models.Product>

@{
    ViewBag.Title = "Index";
    Layout = "~/Areas/Admin/Views/Shared/_Layout.cshtml";
}

<h2>Index</h2>

<p>
    @Html.ActionLink("Create New", "Create")
</p>
<table>
    <tr>
        <th>
            Price
        </th>
        <th>
            Name
        </th>
        <th>
            Description
        </th>
        <th></th>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.Price)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Name)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Description)
        </td>
        <td>
            @using(Html.BeginForm("Update", "Products", FormMethod.Get)) {
                @Html.Hidden("IdProduct", item.Id)
                <input type="submit" value="Update" />
            }

            @using(Html.BeginForm("Delete", "Products")) {
                
                @Html.Hidden("IdProduct", item.Id)
                <input type="submit" value="Remove" />
            }
        </td>
    </tr>
}

</table>
